/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lesson3.slides.net;
import java.io.*;
import java.net.*;

public class TimeServerExample {
    
    public static void main(String[] args) throws Exception{
        ServerSocket ss = new ServerSocket(9876);
        Socket client;
        OutputStream os; PrintStream ps;
        System.out.println("Time service up and running on port 9876");
        while(true){
            client = ss.accept();
            System.out.println("Evan Servicing client "+client.getInetAddress());
            os = client.getOutputStream();
            ps = new PrintStream(os);
            ps.println(new java.util.Date().toString());
            ps.flush();
            ps.close();
            client.close();
        }
    }

}
